import { createApp } from 'vue'
import { createPinia } from 'pinia'
import persistedstate from "pinia-plugin-persistedstate"

import App from './App.vue'
//自动识别 /src/router/index.js文件
import router from './router'
import 'element-plus/dist/index.css'

// 导入 Element-Plus插件
import ElementPlus from 'element-plus'
//element-plus 全局 国际化插件
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
//element-plus 图标插件
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

const app = createApp(App)

const pinia = createPinia();

pinia.use(persistedstate);
//配置pinia插件
app.use(pinia)
//配置路由
app.use(router)
//配置ElementPlus插件给app实例，并配置国际化
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
app.use(ElementPlus, {
    locale: zhCn,
})

app.mount('#app')
